package org.teacuo.eightdays.demo;

import java.io.Serializable;
import java.util.Date;

import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.serializer.SerializerFeature;

public class Demo {
	public static void main(String[] args) {
		User user = new User();
		user.setId(1l);
		user.setName("name");
		user.setRegTime(new Date());
		user.setCls(new UserClass());
		user.getCls().setName("好吧。。 ");
		System.out.println(JSON.toJSONString(user, SerializerFeature.WriteDateUseDateFormat));
	}
}

class User implements Serializable {
	private static final long serialVersionUID = 3027134715706350778L;
	private Long id;
	private String name;
	private Date regTime;
	private Boolean dontKnow;
	private UserClass cls;
	
	/**
	 * @return the cls
	 */
	public UserClass getCls() {
		return cls;
	}

	/**
	 * @param cls the cls to set
	 */
	public void setCls(UserClass cls) {
		this.cls = cls;
	}

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @return the regTime
	 */
	public Date getRegTime() {
		return regTime;
	}

	/**
	 * @return the dontKnow
	 */
	public Boolean isDontKnow() {
		return dontKnow;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

	/**
	 * @param regTime
	 *            the regTime to set
	 */
	public void setRegTime(Date regTime) {
		this.regTime = regTime;
	}

	/**
	 * @param dontKnow
	 *            the dontKnow to set
	 */
	public void setDontKnow(Boolean dontKnow) {
		this.dontKnow = dontKnow;
	}

}

class UserClass implements Serializable {
	private static final long serialVersionUID = -5130852197753640499L;
	private Long id;
	private String name;

	/**
	 * @return the id
	 */
	public Long getId() {
		return id;
	}

	/**
	 * @return the name
	 */
	public String getName() {
		return name;
	}

	/**
	 * @param id
	 *            the id to set
	 */
	public void setId(Long id) {
		this.id = id;
	}

	/**
	 * @param name
	 *            the name to set
	 */
	public void setName(String name) {
		this.name = name;
	}

}